#include <cassert>
#include <cstdlib>
#include <cstring>
#include <fstream>
using namespace std;

//compile with "-o mysql_command"

int main(int argc, char** argv)
{
    char cmd[256];
    ifstream base_file;
    ofstream out_file;
    char c;
    
    assert(argc > 1); //must include a file and amount
    
    base_file.open(argv[1]);
    out_file.open("temp.txt");
    int i = 1;
    string input;
    while(!base_file.eof())
    {
        getline(base_file,input);
        for(int j = 0; j < input.size(); j++)
        {
            if(input[j] == '@')
            {
                string mod_input = "";
                for(int k = 0; k < j; k++)
                {
                    mod_input = mod_input + input[k];
                }
                for(int k = 0; (argv[2])[k] != 0; k++)
                {
                    mod_input = mod_input + (argv[2])[k];
                }
                for(j++;j < input.size(); j++)
                {
                    mod_input = mod_input + input[j];
                }
                swap(input,mod_input);
                break;
            }
        }
        out_file << input << endl;
    }
    
    c = getchar();
    system("pause");
    //strcpy(cmd,"temp.txt > mysql -p -u root");
    
    //system(cmd);
    
    return 0;
}
